<?php

namespace app\admin\controller;

use addon\hotel\model\HotelAccount as HotelAccountModel;

class Hotel extends BaseAdmin
{
    /**
     * 转账设置
     * @return mixed
     */
    public function withdrawConfig()
    {
        $account_model = new HotelAccountModel();
        if (request()->isAjax()) {
            $config_json = input('config_json', '');
            $data = $config_json ? json_decode($config_json, true) : [];
            if (!array_key_exists('id_experience', $data)) {
                $data[ 'id_experience' ] = 0;
            }
            return $account_model->setHotelWithdrawConfig($data);
        } else {
            $config_info = $account_model->getHotelWithdrawConfig();
            $this->assign('config_info', $config_info[ 'data' ]);

            return $this->fetch("hotel/withdraw_config");
        }
    }
}